Repository navigation
feat(runtime): convert evaluate results from Chrome's deep serialization in one call - #677
Merged
Merged
Conversation
…ion in one call evaluate walked every nested object with Runtime.getProperties plus a separate cycle check, and described every node with DOM.describeNode, one CDP call per object or node. Now Runtime.callFunctionOn returns the whole result with serializationOptions: deep, so css on 300 elements takes 1 command instead of 303. Null and undefined stay in arrays, NaN, Infinity, -0 and BigInt are returned instead of nil, getters no longer crash, dates are ISO strings. A cyclic result is a regular Hash/Array with CyclicObject only at the back-reference instead of CyclicObject for the whole value. Node is built from the serialized node's properties and gets backend_node_id, node_type and frame_id readers; description is fetched with DOM.describeNode on first use, node_id is pushed by backendNodeId.
route
force-pushed
the
feat/deep-serialization
branch
from
October 23, 2026 10:39
12b6e9f to
feaf09f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
evaluateused to walk every result object by object:Runtime.getPropertiesper nested object, a separate cycle check, and aDOM.describeNodeper node. It now passesserializationOptions: { serialization: "deep" }toRuntime.callFunctionOnand converts the singledeepSerializedValueChrome returns.Performance
Same page, average of 20 runs:
css("li"), 300 elementsat_cssBehavior changes
Fixed:
nullandundefinedstay in arrays:[1, null, 3]returned[1, 3]NaN,Infinity,-0andBigIntare returned instead ofnilNoMethodErrorChanged:
toStringHash/ArraywithCyclicObjectonly at the reference back to an enclosing object, instead of the whole value beingCyclicObject;windowis{}Nodeis built from the serialized node's properties and getsbackend_node_id,node_typeandframe_idreaders;Node#descriptionis the fullDOM.describeNoderesult, fetched on first use.Node.new(frame, properties)replacesNode.new(frame, target_id, description)Node#node_idusesDOM.pushNodesByBackendIdsToFrontend, since nested nodes come without an object idargumentsobject is aHashwith"0","1"keys, typed arrays are{}Map, Set and RegExp stay
{}as before.